import {h} from "vue";
import {NProgress} from "naive-ui";

export class JobNodeVO {
    id?: bigint;
    nodeIp?: string;
    cpuUsedRatio?: number;
    memoryUsedRatio?: number;
    runningCount?: number;
    alive?: boolean;
}

export const basicColumns = [
    {
        title: "IP地址",
        key: "nodeIp",
        width: 135
    },
    {
        title: "CPU使用率",
        key: "cpuUsedRatio",
        render: (rowData: JobNodeVO) => {
            return h(NProgress, {type: "dashboard", style: "width: 60px;--n-font-size-circle: 18px", percentage: rowData.cpuUsedRatio})
        }
    },
    {
        title: "内存使用率",
        key: "memoryUsedRatio",
        render: (rowData: JobNodeVO) => {
            return h(NProgress, {type: "dashboard", style: "width: 60px;--n-font-size-circle: 18px", percentage: rowData.memoryUsedRatio})
        }
    },
    {
        title: "当前任务数",
        key: "runningCount"
    },
    {
        title: "是否存活",
        key: "alive",
        render: (rowData: JobNodeVO) => {
            return rowData.alive ? "是" : "否";
        }
    },
]
